<template>
  <el-form :model="form" label-width="auto" style="max-width: 600px">
    <el-form-item label="用户名">
      <el-input v-model="form.AccountName" />
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="form.AccountPass" type="password" />
    </el-form-item>
   
    <el-form-item>
      <el-button type="primary" @click="onSubmit">Create</el-button>
      <el-button>Cancel</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import { reactive,ref,onMounted } from 'vue'
import axios from 'axios'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router';
const router=useRouter();

const form = reactive({
  AccountName: '',
  AccountPass: '',
})

const onSubmit = () => {
   axios.get("http://localhost:48806/api/Account/Logion",{
    params:{
      AccountName:form.AccountName,
      AccountPass:form.AccountPass,
    }
   }).then(res=>{
      if (res.data.code == 100) {
        ElMessage.success(res.data.message)
        router.push({
        name:'MainView'
    })
      }
      else{
        ElMessage.error(res.data.message)
      }
    })
}
</script>
